/*
 * Copyright (c) 2024 Black Sesame Technologies
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef _DAL_FASTDDS_DATAREADER_LISTENER_IMPL_DBH_EXTEND_HPP_
#define _DAL_FASTDDS_DATAREADER_LISTENER_IMPL_DBH_EXTEND_HPP_

#include "dal_fastdds/listener_impl/DataReaderListenerImpl.hpp"
#include <fastdds/dds/subscriber/DataReaderListener.hpp>
#include "dal_builtin/msg/dal_dma_buf_heap_recv_notify_msg.hpp"
#include "dalidl_typesupport_fastrtps_cpp/message_type_support.h"
#include "dal_fastrtps_cpp/type_support_common.hpp"
#include "dal_dmabufheap/BufferDescriptorRingBuffer.hpp"

using namespace eprosima::fastdds::dds;

class DataReaderListenerImplDbhExtend : public DataReaderListener
{
public:
    DataReaderListenerImplDbhExtend(const message_type_support_callbacks_t* ts_callbacks_,
                                    dal_dmabufheap::BufferDescriptorRingBuffer* ringbuffer);
    ~DataReaderListenerImplDbhExtend();

    void on_data_available(DataReader* reader) override;

private:
    dal_builtin::msg::DalDmaBufHeapRecvNotifyMsg dbh_recv_notify_msg_;
    const message_type_support_callbacks_t* dbh_recv_notify_msg_ts_callbacks_ = nullptr;
    dal_dmabufheap::BufferDescriptorRingBuffer* ringbuffer_ = nullptr;

    bool is_debug_print_enabled_ = false;
};

#endif  // _DAL_FASTDDS_DATAREADER_LISTENER_IMPL_DBH_EXTEND_HPP_